Page related Commands

Page related Commands

currentPage(...)
currentPage() -> integer

Returns the number of the current working page. Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is.

deletePage(...)
deletePage(nr)

Deletes the given page. Does nothing if the document contains only one page. Page numbers are counted from 1 upwards, no matter what the displayed first page number is.

May raise IndexError if the page number is out of range

getAllObjects(...)
getAllObjects() -> list

Returns a list containing the names of all objects on the current page.

getHGuides(...)
getHGuides() -> list

Returns a list containing positions of the horizontal guides. Values are in the document's current units - see UNIT_<type> constants.

getVGuides(...)
getVGuides()

See getHGuides.

getPageItems(...)
getPageItems() -> list

Returns a list of tuples with items on the current page. The tuple is: (name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)] means that object named 'Text1' is a text frame (type 4) and is the first at the page...

getPageMargins(...)
getPageMargins()

Returns the page margins as a (top, left, right, bottom) tuple in the current units. See UNIT_<type> constants and getPageSize().

getPageSize(...)
getPageSize() -> tuple

Returns a tuple with page dimensions measured in the document's current units. See UNIT_<type> constants and getPageMargins()

gotoPage(...)
gotoPage(nr)

Moves to the page "nr" (that is, makes the current page "nr"). Note that gotoPage doesn't (curently) change the page the user's view is displaying, it just sets the page that script commands will operates on.

May raise IndexError if the page number is out of range.

newPage(...)
newPage(where [,"template"])

Creates a new page. If "where" is -1 the new Page is appended to the document, otherwise the new page is inserted before "where". Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is. The optional parameter "template" specifies the name of the template page for the new page.

May raise IndexError if the page number is out of range

pageCount(...)
pageCount() -> integer

Returns the number of pages in the document.

pageDimension(...)
getPageSize() -> tuple

Alias. Returns a tuple with page dimensions measured in the document's current units. See UNIT_<type> constants and getPageMargins()

redrawAll(...)
redrawAll()

Redraws all pages.

savePageAsEPS(...)
savePageAsEPS("name")

Saves the current page as an EPS to the file "name".

May raise ScribusError if the save failed.

setHGuides(...)
setHGuides(list)

Sets horizontal guides. Input parameter must be a list of guide positions measured in the current document units - see UNIT_<type> constants.

Example: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost
setHGuides([90,250]) # replace current guides entirely

setRedraw(...)
setRedraw(bool)

Disables page redraw when bool = False, otherwise redrawing is enabled. This change will persist even after the script exits, so make sure to call setRedraw(True) in a finally: clause at the top level of your script.

setVGuides(...)
setVGuides()

See setHGuides.